{% extends "BluehouseappWebBundle:Frontend/layout:layout.html.twig" %}
{% from 'BluehouseappWebBundle:Macros:misc.html.twig'  import pagination %}

{% block body -%}
    <div class="h20"></div>
    <div class="box">
        <div class="box_cell">
            {#<div class="box_fr"><img src="/static/img/rss.png" align="absmiddle">&nbsp; <a href="/feed/member/konakona.xml">Atom</a></div>#}
            <span class="box_gray">
                {% if  member.nickname  %}
                    {{ member.nickname }}
                {% else %}
                    {{ member.username }}
                {% endif %} 最近创建的主题</span></div>

        {% for post in posts %}
            <div class="box_cell box_item" style="border-top-left-radius: 3px; border-top-right-radius: 3px;"><div style="position: absolute; margin: -10px -10px 0px 650px;"></div>
                <table cellpadding="0" cellspacing="0" border="0" width="100%">
                    <tbody><tr>

                        <td width="auto" valign="middle"><span class="box_item_title">
                            <a href="{{ path('post_show', { 'id': post.id }) }}">{{ post.title }}</a>
                        </span>
                            <div class="box_sep5"></div>
                        <span class="box_small box_fade"><div class="box_votes">

                            </div><a class="box_node" href="#"></a> &nbsp;•&nbsp; <strong>
                                <a href="{{ path('user_show', { 'username': post.member.username }) }}">
                                    {% if   post.member.nickname  %}
                                        {{  post.member.nickname }}
                                    {% else %}
                                        {{  post.member.username }}
                                    {% endif %}
                                </a></strong> &nbsp;•&nbsp;
                            {{ time_diff(post.created) }}

                            {% if lastComments[post.id] %}
                                &nbsp;•&nbsp;
                                {% set lastCommentMember= lastComments[post.id].member %}
                                最后回复来自 <strong>
                                <a  href="{{ path('user_show', { 'username': lastCommentMember.username }) }}">
                                    {% if lastCommentMember.nickname %}
                                        {{ lastCommentMember.nickname }}
                                    {% else %}
                                        {{ lastCommentMember.username }}
                                    {% endif %}
                                </a>
                            </strong>
                            {% endif %}
            </span>
                        </td>
                        <td width="50" align="right" valign="middle">
                            {% if post.commentCount>0 %}
                                <a href="{{ path('post_show', { 'id': post.id }) }}" class="box_count_livid">{{ post.commentCount }}</a>
                            {% endif %}
                        </td>
                    </tr>
                    </tbody></table>
            </div>
        {% endfor %}



    </div>

    {{ pagination(posts) }}

{% endblock %}